package cn.z2huo.knowledge.thinkinginjava.finalize;

/**
 * <p>
 *
 * @author z2huo
 */
class Book {

    boolean checkOut = false;

    public Book(boolean checkOut) {
        this.checkOut = checkOut;
    }

    void checkIn() {
        checkOut = false;
    }

    @Override
    protected void finalize() throws Throwable {
        if (checkOut) {
            System.out.println("error: checked out");
            super.finalize();
        }
    }
}
